﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HySoft.Cash.Business;
using HySoft.Cash.Structure;

namespace PayRoller.Manage.Reports
{
    public partial class PaymentReportSetting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                this.DisplaySettingsStatus();
            }
        }

        private void DisplaySettingsStatus()
        {
            ReportSettingsBN business = new ReportSettingsBN(this.Page);
            ReportSettingsPaymentDT setting = business.GetReportSettingsPayment(0);
            if (setting != null)
            {
                this.cbClientName.Checked = setting.IsDisplayOrgName;
                this.cbOurReference.Checked = setting.IsDisplaySystemReference;

                this.cbEmployeeID.Checked = setting.IsDisplayEmployeeID;
                this.cbEmployeeName.Checked = setting.IsDisplayEmployeeName;
                this.cbEmployeeList.Checked = setting.IsDisplayEmployeeList;

                this.cbAC.Checked = setting.IsDisplayAC;
                this.cbAmount.Checked = setting.IsDisplayAmount;
                this.cbBankName.Checked = setting.IsDisplayBankName;
                this.cbBSB.Checked = setting.IsDisplayBSB;
                this.cbPaymentDate.Checked = setting.IsDisplayPaymentDate;
                this.cbPaymentList.Checked = setting.IsDisplayPaymentList;
                this.cbReference.Checked = setting.IsDisplayReference;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            ReportSettingsPaymentDT setting = new ReportSettingsPaymentDT();
            setting.UserID = 0;
            setting.IsDisplayOrgName = this.cbClientName.Checked;
            setting.IsDisplaySystemReference = this.cbOurReference.Checked;
            setting.IsDisplayEmployeeName = this.cbEmployeeName.Checked;
            setting.IsDisplayEmployeeID = this.cbEmployeeID.Checked;
            setting.IsDisplayEmployeeList = this.cbEmployeeList.Checked;
            setting.IsDisplayAC = this.cbAC.Checked;
            setting.IsDisplayAmount = this.cbAmount.Checked;
            setting.IsDisplayBankName = this.cbBankName.Checked;
            setting.IsDisplayBSB = this.cbBSB.Checked;
            setting.IsDisplayPaymentDate = this.cbPaymentDate.Checked;
            setting.IsDisplayPaymentList = this.cbPaymentList.Checked;
            setting.IsDisplayReference = this.cbReference.Checked;

            ReportSettingsBN business = new ReportSettingsBN(this.Page);
            business.OperateReportSettingsPayment(setting);
        }
    }
}
